package com.tianyi.factory.simple;

import com.tianyi.factory.Apple;
import com.tianyi.factory.Huawei;
import com.tianyi.factory.Mobile;
import com.tianyi.factory.Xiaomi;

//所谓万能的工厂，实际生活中是不存在的
//消费者无需关心细节，但是对于生产者来说，维护太麻烦
public class SimpleFactory {
	public Mobile getMobile(String name){
		if("Apple".equalsIgnoreCase(name)){
			return new Apple();
		}else if("Xiaomi".equalsIgnoreCase(name)){
			return new Xiaomi();
		}else if("Huawei".equalsIgnoreCase(name)){
			return new Huawei();
		}else{
			System.out.println("暂无产品生产功能");
			return null;
		}
	}
}
